
public class Person {
    private String name;
    private int age;
    private int sex;
    private static int nowCount = 0;

    public Person() {nowCount++;}

    public Person( String name,int age, int sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        nowCount++;
    }
    public static int count() {
        return nowCount;
    }
    /*this的作用：this代表方法调用者的地址值，如上面，调用方法的为Main类中的person1对象，故this.age即为person1对象所开辟的堆空间中age属性，并
    令其等于输入的实参age从而将输入的实参赋值给person1的age属性
    下面的this作用相似，将other这个输入的对象的age属性赋值给调用这个方法的对象的age属性*/
    public Person(Person other) {
        this.name = other.name; 
        this.age = other.age;   
        this.sex = other.sex;   
        nowCount++;
    }
    public String getName(){
        eat();
        return name;
    }
    public int getAge() {
        return age;
    }
    public int getSex() {
        return sex;
    }
    private void eat() {
    	System.out.println(name+"正在吃东西");
    }

    public void sleep() {
        System.out.println(name+"正在睡觉");
    }

    private void dadoudou() {
    	
    }

    
}